import os
import cherrypy
class dbConfig(object):
    HOST = 'localhost'
    DATABASE = 'orchard'
    USER = 'root'
    PASSWORD = '[]'
    PORT = 3306
    
    CHARSET = 'utf8'
    UNICODE = True
    WARNINGS = True
    
    @classmethod
    def dbinfo(cls):
        return {
            'host': cls.HOST,
            'database': cls.DATABASE,
            'user': cls.USER,
            'password': cls.PASSWORD,
            'charset': cls.CHARSET,
            'use_unicode': cls.UNICODE,
            'get_warnings': cls.WARNINGS,
            'port': cls.PORT,
            }
users = {'admin': 'admin'}
_cp_config = {
              'global': { 
                'sessionFilter.locking': 'implicit',
                'server.socket_port' : 8080,
                'server.socket_host': "localhost",
                'server.socket_file': "",
                'server.socket_queue_size': 5,
                'server.protocol_version': "HTTP/1.0",
                'server.log_to_screen': True,
                'server.log_file': "",
                'server.reverse_dns': False,
                'server.thread_pool': 10,
                'server.environment': "development" 
             },
                    
              '/assets': {
                'tools.staticdir.on': True,
                'tools.staticdir.root': os.path.abspath(os.path.curdir),
                'tools.staticdir.dir': 'assets'
                  },
              '/':{
                  'tools.cpstats.on': True,
                  'tools.memcache.on': True,
                   'tools.memcache.keys': {'regnum': '7YADd4aAYV', 'pin': '4392', 'year': 2012, 'data': False},
#                   'tools.template.on': True,
#                   'tools.template.template': 'index.html',
#                   'tools.encode.on': True
                  },
              '/result':{
                    'tools.memcache.on': True,
                    'tools.memcache.keys': {}
#                    'tools.template.template': 'result.html',
#                    'tools.encode.on': False
                },
              
              }

userpassdict = {'admin' : 'techytom', 'guest' : 'guest'}
checkpassword = cherrypy.lib.auth_basic.checkpassword_dict(userpassdict)

_admin_config = { 
              '/assets': {
                'tools.staticdir.on': True,
                'tools.staticdir.root': os.path.abspath(os.path.curdir),
                'tools.staticdir.dir': 'assets'
                  },
              '/':{
                   'tools.sessions.on': True,
                 },
              '/result':{
                    'tools.memcache.on': True,
                    'tools.memcache.keys': {}
#                    'tools.template.template': 'result.html',
#                    'tools.encode.on': False
                },
              
              }
